<template>
  <WujieVue :afterMount="handleOnSubBeforeMount" name="cso-app" :url="url" :sync="true" :props="props"></WujieVue>
</template>

<script lang="ts" setup>
import { computed, onMounted, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import WujieVue from "wujie-vue3";
const router = useRouter();


const props = {
  jump: router.push
}
const route = useRoute();
const url = computed(()=>{
  return "http://localhost:3001/"
});
let first = true
watch(()=> route.params.path, (val)=>{
  const path = route.params.path
  asyncSubAppRouterChange(path)
}, {
  immediate: true
})
function handleOnSubBeforeMount() {
  asyncSubAppRouterChange()
}

function asyncSubAppRouterChange(path = route.params.path) {
  WujieVue.bus.$emit('cso-router-change', route.params.path)
}

// onMounted(()=>{
//   console.log(route.path)
//   WujieVue.bus.$emit('cso-router-change', `/${route.params.path}`)
// })
</script>

<style></style>
